/*----------------------------------------------------------------------------\
|                                字符串处理JS
|-----------------------------------------------------------------------------
|                   Copyright (c) 2003 Gnct
|               作者:luoshiqiang(email:Imlsq@hotmail.com)
\----------------------------------------------------------------------------*/

function StringHelper()
{

}

/**
* 给出路经查找文件名(不包含扩展名)
*/
StringHelper.prototype.getFileName=function (filePath)
{
  if(filePath==null)
     return "";

  var index=filePath.lastIndexOf("\\");
  if(index==-1)
    return "";

  var Lfname=filePath.substring(index+1);
  var exIndex=Lfname.lastIndexOf(".");

  if(exIndex==-1)
    return Lfname;

  var fileName=Lfname.substring(0,exIndex);

  return fileName;
}

/**
* 给出路经查找文件的扩展名
*/
StringHelper.prototype.getExtendName=function (filePath)
{

  if(filePath==null)
     return "";
  var Lfname=filePath;
  var index=filePath.lastIndexOf("\\");
  if(index>0)
  {
   Lfname=filePath.substring(index+1);
  }
  var exIndex=Lfname.lastIndexOf(".");

  if(exIndex==-1)
    return "";

  var extName=Lfname.substring(exIndex+1);

  return extName;
}

StringHelper.prototype.getChineseDate=function(syear, smonth,sday){
	var nian="";
	var yue="";
	var ri="";
	var nianfen="";
	var k;
        for(k=0;k<syear.length;k++){
          switch(syear.charAt(k)){
		case '0':
                  nian=nian+"Ο";
                  break;
		case "1":
                  nian=nian+"一";
                  break;
		case "2":
                  nian=nian+"二";
                  break;
		case "3":
                  nian=nian+"三";
                  break;
		case "4":
                  nian=nian+"四";
                  break;
		case "5":
                  nian=nian+"五";
                  break;
		case "6":
                  nian=nian+"六";
                  break;
		case "7":
                  nian=nian+"七";
                  break;
		case "8":
                  nian=nian+"八";
                  break;
		case "9":
                  nian=nian+"九";
                  break;

	    }

	}

	switch(smonth){
	 case "10":
           yue=yue+"十";
           break;
	case "11":
          yue=yue+"十一";
          break;
	case "12":
          yue=yue+"十二";
          break;
	case "01":
          yue=yue+"一";
          break;
	case "02":
          yue=yue+"二";
          break;
	case "03":
          yue=yue+"三";
          break;
	case "04":
          yue=yue+"四";
          break;
	case "05":
          yue=yue+"五";
          break;
	case "06":
          yue=yue+"六";
          break;
	case "07":
          yue=yue+"七";
          break;
	case "08":
          yue=yue+"八";
          break;
	case "09":
          yue=yue+"九";
          break;
	}

	if(sday.length==2){
		switch(sday.charAt(0)){
		 case "1":
                  ri=ri+"十";
                  break;
		 case "2":
                  ri=ri+"二十";
                  break;
		 case "3":
                   ri=ri+"三十";
                   break;
		}

		switch(sday.charAt(sday.length-1)){
		 case "0":
                   ri=ri;
                   break;
		 case "1":
                   ri=ri+"一";
                   break;
		 case "2":
                   ri=ri+"二";
                   break;
		 case "3":
                   ri=ri+"三";
                   break;
		 case "4":
                   ri=ri+"四";
                   break;
		 case "5":
                   ri=ri+"五";
                   break;
		 case "6":
                   ri=ri+"六";
                   break;
		 case "7":
                   ri=ri+"七";
                   break;
		 case "8":
                   ri=ri+"八";
                   break;
		 case "9":
                   ri=ri+"九";
                   break;
		}
	}else{
		switch(sday.charAt(0)){
		 case "1":
                  ri=ri+"一";
                  break;
		case "2":
                  ri=ri+"二";
                  break;
		case "3":
                  ri=ri+"三";
                  break;
		case "4":
                  ri=ri+"四";
                  break;
		case "5":
                  ri=ri+"五";
                  break;
		case "6":
                  ri=ri+"六";
                  break;
		case "7":
                  ri=ri+"七";
                  break;
		case "8":
                  ri=ri+"八";
                  break;
		case "9":
                  ri=ri+"九";
		}
	}

      return nian+"年"+yue+"月"+ri+"日";

}